#-*-coding:utf8-*-

import re
import urllib


a = urllib.urlopen("http://www.ozgurlukicin.com/podcast/")
ozet = re.compile('<div class="title"><a href="(.+?)"')
podCastAdres = ozet.findall(a.read())

b = urllib.urlopen("http://www.ozgurlukicin.com/podcast/")
digerOzet = re.compile("""<div class="summary">(.+?)<""")
summaryOther = digerOzet.findall(b.read())

c = urllib.urlopen("http://www.ozgurlukicin.com/podcast/feed/mp3/")
guncelbaslik = re.compile("""<title>(.+?)</title>""")
titleNow = guncelbaslik.findall(c.read())

baslik = "<b>Başlık:</b> "+titleNow[0]
	
d = urllib.urlopen("http://www.ozgurlukicin.com/podcast/feed/mp3/")
guncelUzunluk = re.compile("""<itunes:duration>(.+?)</itunes:duration>""")
uzunluk = guncelUzunluk.findall(d.read())

sure = "<b>Uzunluk:</b> "+uzunluk[0]

e = urllib.urlopen("http://www.ozgurlukicin.com/podcast/feed/mp3/")
aa = re.compile("""<description>(.+?)</description>""", re.U)
descrip = aa.findall(e.read())

aciklama = "<b>Açıklama:</b> "+descrip[1]

aut = urllib.urlopen("http://www.ozgurlukicin.com/podcast/feed/mp3/")
autho = re.compile("""<author>(.+?)</author>""", re.U)
author = autho.findall(aut.read())

sunucu = "<b>Sunucu:</b> "+author[0]

tar = urllib.urlopen("http://www.ozgurlukicin.com/podcast/feed/mp3/")
tari = re.compile("""<pubDate>(.+?)</pubDate>""", re.U)
tarih = tari.findall(tar.read())

zaman = "<b>Tarih:</b> "+tarih[0]

#mp3 adresleri

adrsMP = urllib.urlopen("http://www.ozgurlukicin.com/podcast/feed/mp3/")
adresM = re.compile("""<enclosure url="(.+?)" length""", re.U)
adresMP3 = adresM.findall(adrsMP.read())

print adresMP3[0]

#ogg adresleri
ogG = urllib.urlopen("http://www.ozgurlukicin.com/podcast/feed/ogg/")
ogg = re.compile("""<enclosure url="(.+?)" length""", re.U)
adresOGG = ogg.findall(ogG.read())

print adresOGG[0]
#ajans numaraları ör: ajans '63/'
no1 = podCastAdres[0].split("E")[1]
no2 = podCastAdres[1].split("E")[1]
no3 = podCastAdres[2].split("E")[1]
no4 = podCastAdres[3].split("E")[1]
no5 = podCastAdres[4].split("E")[1]
no6 = podCastAdres[5].split("E")[1]
no7 = podCastAdres[6].split("E")[1]
no8 = podCastAdres[7].split("E")[1]
no9 = podCastAdres[8].split("E")[1]
no10 = podCastAdres[9].split("E")[1]
no11 = podCastAdres[10].split("E")[1]

# açıklamaları alır
summaryOther1 = summaryOther[0].replace("<p>", "")
summaryOther2 = summaryOther[1].replace("<p>", "")
summaryOther3 = summaryOther[2].replace("<p>", "")
summaryOther4 = summaryOther[3].replace("<p>", "")
summaryOther5 = summaryOther[4].replace("<p>", "")
summaryOther6 = summaryOther[5].replace("<p>", "")
summaryOther7 = summaryOther[6].replace("<p>", "")
summaryOther8 = summaryOther[7].replace("<p>", "")
summaryOther9 = summaryOther[8].replace("<p>", "")
summaryOther10 = summaryOther[9].replace("<p>", "")
summaryOther11 = summaryOther[10].replace("<p>", "")